from django.http import response
from django.shortcuts import redirect
from django.utils.deprecation import MiddlewareMixin
from django.urls import reverse


class MD1(MiddlewareMixin):
    def process_request(self, request):
        if not request.session.get("is_login"):
            if request.path != '/login':
                print(request.path)
                return redirect('/login')
